package com.shanjupay.common.util;


import org.apache.commons.lang.StringUtils;

import java.util.Random;

public class RandomUtils {

    /**
     * 得到使用随机数字组成的字符串
     *
     * @param numberStrLength 字符串的长度
     * @return string
     */
    public static String randomNumberStr(int numberStrLength) {
        if (numberStrLength < 1) {
            return StringUtils.EMPTY;
        }
        Random random = new Random();
        StringBuilder randomNumberStr = new StringBuilder();
        for (int i = 0; i < numberStrLength; i++) {
            randomNumberStr.append(random.nextInt(10));
        }
        return randomNumberStr.toString();
    }
}
